package com.szzg10.thinking.chapter11;

import java.util.HashMap;
import java.util.Map;

public class PetMap {

	public static void main(String[] args) {
		Map<String, Pet> pets = new HashMap<String, Pet>();
		pets.put("My Cat", new Cat());
		pets.put("My Dog", new Dog());
		pets.put("My Hamster", new Hamster());
		System.out.println(pets);
		
		Pet dog = pets.get("My Dog");
		System.out.println(dog);
		
		System.out.println(pets.containsKey("My Dog"));
		System.out.println(pets.containsValue(dog));
	}
}
